package me.frank.security.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import me.frank.security.entity.User;
import me.frank.security.service.UserService;
import me.frank.security.support.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Frank Wang
 * @Description:
 * @Date 2018/12/11 14:07
 */
@RestController
@Api(value = "用户相关接口")
public class UserController {
    @Autowired
    private UserService userService;

    @ApiOperation(value = "用户注册")
    @PostMapping("/user/register")
    public Result registerUser(@RequestBody User user){
        boolean bool = userService.createUser(user);
        if(bool){
            return Result.ok("注册成功！");
        }else {
            return Result.error("注册失败");
        }
    }
}
